////////////////////////////////////////////////////////////////////////////
//	InputMessage.h
//		Class that contains information about a player control (input)
//		that needs to be sent to other classes so that they can handle it.
//		It has a type, two flexible WORD parameters and an ID that can be
//		set and checked for key binding. Instances of the InputMessage class
//		are generated in the InputManager after receiving Windows Messages.
//
//	Author:					Daniel Lima - March 2012
/////////////////////////////////////////////////////////////////////////////

#ifndef INPUT_MESSAGE_H_
#define INPUT_MESSAGE_H_

// Necessary to be able to easily print data to the console window
#include <iostream>
#ifdef _DEBUG
#define LOG(info) std::cout << info << std::endl;
#else
#define LOG(info)
#endif


class InputMessage
{
	//	Type of input - Relative to EInputMsgType (key pressed, key down, etc.)
	unsigned char	m_ucType;
	
	//	ID - Used for key binding
	unsigned char	m_ucID;

	//	X Parameter
	//		Key down / Key pressed				- Which key was pressed
	//		Mouse move / Mouse down / Mouse up	- Position X of the click
	//		Mouse wheel							- Distance the weel was rotated
	WORD			m_wXParam;
	//	Y Parameter
	//		Key down / Key pressed				- Time in miliseconds that the key has been held down
	//		Mouse move / Mouse down / Mouse up	- Position Y of the click
	//		Mouse wheel							- (none)
	WORD			m_wYParam;

public:
	//	Constructor - Initializes all data members to the variables passed as parameters.
	InputMessage(unsigned char ucInputType, WORD wXParam, WORD wYParam, unsigned char ucID = 0)
	{
		m_ucType		= ucInputType;
		m_wXParam		= wXParam;
		m_wYParam		= wYParam;
		m_ucID			= ucID;

		if(ucInputType != MOUSE_MOVE)
			LOG("X Param: " << wXParam << "\tY Param: " << wYParam);
	}

	///// Accessors ////////////////////////////////////
	inline unsigned char	GetType			(void) const { return m_ucType; }
	inline WORD				GetXParam		(void) const { return m_wXParam; }
	inline WORD				GetYParam		(void) const { return m_wYParam; }
	inline unsigned char	GetID			(void) const { return m_ucID; }
	////////////////////////////////////////////////////

	// Types of input messages
	enum EInputMsgType
	{
		KEY_PRESSED,		KEY_DOWN,			KEY_UP,
		SYSKEY_PRESSED,		SYSKEY_DOWN,		SYSKEY_UP,
		MOUSE_RIGHT_CLICK,	MOUSE_RIGHT_DOWN,	MOUSE_RIGHT_UP,
		MOUSE_LEFT_CLICK,	MOUSE_LEFT_DOWN,	MOUSE_LEFT_UP,
		MOUSE_MIDDLE_CLICK, MOUSE_MIDDLE_DOWN,	MOUSE_MIDDLE_UP,
		MOUSE_WHEEL_VERT, MOUSE_WHEEL_HOR,
		MOUSE_MOVE
	};
};

#endif